package com.note7_8;

import java.io.*;

public class Question2_pro {

	public static void main(String[] args) throws IOException {
		/*
		 * 输入一个文件名，输出最后10个字节（提示，RandomAccessFile类）
		 */
		File f = new File("src/com/pet.template");
		int i = (int) (f.length()-10);
		RandomAccessFile raf = new RandomAccessFile(f, "r");
		byte[] b = new byte[10];
		int len = -1;
		String s = null;
		while((len = raf.read(b)) != -1){
			s = new String(b);
			System.out.println(len);
		}
		
		System.out.println(s);
	}
}
